export const addModelFormFields = [
    {
        label: "单位名称",
        key: "name",
        el: "AInput",
        attrs: {
            placeholder: "请输入",
        },
        required: true,
    },
    {
        label: "是否显示",
        key: "age",
        el: "ASelect",
        attrs: {
            options: [
                { value: 1, label: "显示" },
                { value: 2, label: "隐藏" },
            ],
        },
        required: true,
        on: {
            change: () => {},
        },
    },
    {
        label: "所属地区",
        key: "address",
        el: "AInput",
        attrs: {},
        required: true,
        rules: [{ validator: validateInput, trigger: "change" }],
    },
    {
        label: "地区名称",
        key: "area",
        el: "AInput",
    },
    {
        key: "conetext",
        label: "举报内容",
        el: "VWangeditor",
    },
];

function validateInput(rules, value, callback) {
    if (!value) return callback(new Error("这是必填项"));
    callback();
}

export const editModelFormFields = [
    {
        label: "单位名称",
        key: "name",
        el: "AInput",
        attrs: {
            placeholder: "请输入",
        },
    },
    {
        label: "是否显示",
        key: "age",
        el: "ASelect",
        attrs: {
            options: [
                { value: 1, label: "显示" },
                { value: 2, label: "隐藏" },
            ],
        },
        on: {
            change: () => {},
        },
        decorator: {
            rules: [
                {
                    required: true,
                    message: "请输入!",
                },
            ],
        },
    },
    {
        label: "所属地区",
        key: "address",
        el: "AInput",
        attrs: {},
    },
    {
        label: "地区名称",
        key: "area",
        el: "AInput",
    },
    {
        key: "conetext",
        label: "举报内容",
        el: "VWangeditor",
    },
];
